//
//  ViewController.swift
//  test
//
//  Created by 彭爽 on 2021/5/21.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        
        typealias testBlock = (String) -> Void

        let aaa: testBlock = {str in
            print(str)
        }
        aaa("sss")
        
        
        
        showYouTest { (index) in
            print(index)
        }
    }
    

    func showYouTest(testBlock: @escaping (_ index:Int) -> Void) {
        //做一个延迟操作
        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 5) {
            //五秒之后调用闭包
            testBlock(8)
        }
        print("我是函数")
    }

}

